import {ActorState} from "db://assets/Script/Actor/ActorState";
import {StateEnum} from "db://assets/Script/Enums/StateEnum";
import {AnimationEnum} from "db://assets/Script/Enums/AnimationEnum";

export class Attack extends ActorState {
    onEnter() {
        console.log('Attack执行攻击动画')
        let hasIdle = this.animation.getState(AnimationEnum.PLAYER_ATTACK);
        if (hasIdle) {
            this.animation.crossFade(AnimationEnum.PLAYER_ATTACK)
        }
    }

    onDestroy() {
    }

    onExit() {
    }

    canTransition(to: StateEnum): boolean {
        //非死亡状态下可以转换任意状态
        return to !== StateEnum.DIE;
    }

    update(deltaTime: number) {
    }
}
